<template>
	<!-- 冲突查询页面 -->
	<view style="padding-left: 32rpx;padding-right: 32rpx;">
		<view class="top-item">
			<text class="top-item-title">客户名称</text>
			<input type="text"
			v-model="custName"
			placeholder="请输入" class="placeholder-view">
		</view>
		<view class="top-item">
			<text class="top-item-title">标的名称</text>
			<input type="text"
			v-model="targetName"
			placeholder="请输入" class="placeholder-view">
		</view>
		<view class="top-item">
			<text class="top-item-title">对方名称</text>
			<input type="text"
			v-model="otherName"
			placeholder="请输入" class="placeholder-view">
		</view>
		<view class="view-bottom-sl" @click="search">
			查询
		</view>
		
		<view class="view-center" v-if="showResult">
			<text class="view-center-l">查询结果</text>
			<text class="view-center-r">与{{dataListLength}}条数据冲突</text>
		</view>
		
		<view class="" v-if="showResult">
			<view class="view-bottom-top">
				<view style="width: 370rpx;">
					<text class="view-bottom-top-title" style="margin-left: 32rpx;">输入词</text>
				</view>
				<view style="width: 144rpx;">
					<text class="view-bottom-top-title">冲突词</text>
				</view>
				<view style="width: 172rpx;">
					<text class="view-bottom-top-title">冲突词类型</text>
				</view>
			</view>
			
			<view  v-for="(item,index) in dataList" :key="index">
				<view class="view-bottom-top-list">
					<view style="width: 370rpx;">
						<text class="view-bottom-top-content" style="margin-left: 32rpx;">{{item.importStr}}</text>
					</view>
					<view style="width: 144rpx;">
						<text class="view-bottom-top-content">{{item.value}}</text>
					</view>
					<view style="width: 172rpx;">
						<text class="view-bottom-top-content">{{item.dictCode}}</text>
					</view>
				</view>
				
				
			</view>
			
		</view>
		
	</view>
</template>

<script>
	let app = ''
	export default{
		data(){
			return{
				showResult:false,
				dataList:[
					
				],
				dataListLength:0,
				custName:'',
				targetName:'',
				otherName:'',
				role:'',
			}
		},
		onLoad() {
			app = getApp()
			this.role = app.globalData.role
		},
		onShow() {
			
		},
		mounted() {
			
		},
		methods:{
			/**
			 * 查询
			 */
			async search(){
				let _this = this
				let url = ''
				if(_this.custName==''&& _this.targetName==''&&_this.otherName==''){
					uni.showToast({
						title:'至少输入一个名称',
						icon:"none"
					})
					return
				}
				if(_this.role =='1' || _this.role=='2'){
					url = '/admin/clash/check'
				}else if(_this.role=='3'|| _this.role=='4'){
					url = '/biz/clash/check'
				}
				
				const res = await _this.$myRequest({
					url: url,
					data:{
						custName:_this.custName,
						targetName:_this.targetName,
						otherName:_this.otherName
					},
					method:'get',//默认是GET
				})
				console.log('冲突查询',res)
				if(res.data.code==200){
					_this.dataList = res.data.data
					_this.dataListLength = _this.dataList.length
					this.showResult = true
				}
			},
		}
	}
</script>

<style>
	page{
		background-color: #ffffff;
	}
</style>
<style scoped lang="scss">
	.top-item{
		height: 108rpx;
		border-bottom: 1rpx #eeeeee solid;
		display: flex;
		align-items: center;
	}
	.top-item-title{
		font-size: 28rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
	}
	.placeholder-view{
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 500;
		color: #333333;
		margin-left: auto;
		text-align: right;
	}
	.view-bottom-sl{
		width: 686rpx;
		height: 88rpx;
		background: #2DA9C5;
		border-radius: 58rpx;
		font-size: 36rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #E8F7FB;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 48rpx;
	
	}
	
	.view-center{
		display: flex;
		align-items: center;
		margin-top: 80rpx;
	}
	.view-center-l{
		font-size: 36rpx;
		font-family: PingFangSC-Semibold, PingFang SC;
		font-weight: 600;
		color: #333333;
	}
	.view-center-r{
		margin-left: auto;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #FF6132;
	}
	
	.view-bottom-top{
		width: 686rpx;
		height: 80rpx;
		background: #E8F7FB;
		display: flex;
		align-items: center;
		margin-top: 24rpx;
	}
	.view-bottom-top-title{
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #666666;
	}
	.view-bottom-top-list{
		display: flex;
		align-items: center;
		height: 88rpx;
		border-bottom: 1rpx solid #eeeeee;
		
	}
	.view-bottom-top-content{
		font-size: 24rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #333333;
	}
</style>